const { ref } = Vue
import { useFetch } from '../../../Scripts/hooks/useFetch.js'
const { ElMessage, ElMessageBox } = ElementPlus

export function useUnReportData() {
  let notReportedList = ref([]);//【待报工】数据
  let unReportDataRows = ref(0);//【待报工】总数
  // 查询待报工数据
  const getUnReportedData = async configObj => {
    const { data, total } = await useFetch({
      url: `${configObj.url}?actions=${configObj.method}`,
      data: {
        ...configObj,
        type: `${configObj.method}`,
        factoryid: configObj.factoryid,
        workerid: configObj.workerid
      }
    });
    notReportedList.value = data.value;
    unReportDataRows.value = total;
  }

  return {
    notReportedList,
    unReportDataRows,
    getUnReportedData
  }
}